#include <memory>
#include <WinSock2.h>

#include <ballade/util/func.h>

namespace Ballade
{
	
	namespace Util
	{
		void UTIL_API repr(const char *buf, const char *s, const int len)
		{
			const char *iter = buf;
			for(int i = 0; i < len; i++)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
			{
				char buf_[20];
				memset(buf_, 0x00, 20);
				
				sprintf(buf_, "0x%X", *(s + i));
				memcpy((void *)iter, buf_, strlen(buf_));
				iter += strlen(buf_);
			}
		}
		
		float UTIL_API ntohf(float f)
		{
			unsigned long l = ntohl(*((unsigned long *) &f));
			return *((float *)&l);
		}
		
		float UTIL_API htonf(float f)
		{
			unsigned long l = htonl(*((unsigned long *) &f));
			return *((float *)&l);
		}
	}

}